package com.ymatou.iapi.godmch.testcase;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.codehaus.groovy.control.io.NullWriter;
import org.json.JSONException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.godmch.parameter.applyAgentBean;
import com.ymatou.iapi.godmch.parameter.approveAgentBean;
import com.ymatou.iapi.godmch.parameter.createIndepMchBean;
import com.ymatou.iapi.godmch.parameter.createagentBean;
import com.ymatou.iapi.godmch.parameter.rejectAgentBean;
import com.ymatou.iapi.godmch.service.applyAgentCall;
import com.ymatou.iapi.godmch.service.createIndepMchCall;
import com.ymatou.iapi.godmch.service.createagentCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.agent_type;
import com.ymttest.database.model.country_info;
import com.ymttest.database.model.mch_info;
import com.ymttest.database.model.godmch.mch_config;
import com.ymttest.database.model.godmch.mch_configExample;
import com.ymttest.database.sqlwapper.godmch.country_infoWapper;
import com.ymttest.database.sqlwapper.godmch.mch_configWapper;
import com.ymttest.database.sqlwapper.godmch.mch_infoWapper;
import com.ymttest.utils.TestDataManager;
/**
*创建独立商户
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_createIndepMch{
	private static createIndepMchBean bean;
	private static createIndepMchCall call;
	
	mch_infoWapper infoWapper=new mch_infoWapper();
	country_infoWapper country_infoWapper=new country_infoWapper();
	
	mch_configWapper configWapper;
	mch_configExample configExample;
	country_infoWapper countryinfoWapper;
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建独立商户");
	}

	@Before
	public void caseUp() {
		bean=new createIndepMchBean();
		call=new createIndepMchCall();
		configWapper=new mch_configWapper();
		configExample=new mch_configExample();
		countryinfoWapper=new country_infoWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private void check_verify() throws JSONException, InterruptedException
	{
		Logger.verifyEquals("200", call.getStatusCode1(), "验证status");
		Logger.verifyEquals("请求成功", call.getMessage(), "验证Message");
		
		List<Integer> mchIds=new ArrayList<Integer>();
		mchIds.add(call.getmchId());
		mch_info  info=infoWapper.selectbyMchIds(mchIds).get(0);
		
		configExample.createCriteria().andMchIdEqualTo(call.getmchId());
	    mch_config  config=configWapper.selectByExample(configExample).get(0);
	    
		Logger.verifyEquals(true, info.getMchId()>0, "验证数据库mch_info新增一条数据");
		Logger.verifyEquals(true, config.getMchId()>0, "验证数据库mch_config新增一条数据");
		//mch_info
		Logger.verifyEquals(0, info.getAgent(), "验证数据库mch_info中的agent");
		Logger.verifyEquals(1, info.getChannels(), "验证数据库mch_info中的Channels");
		Logger.verifyEquals(bean.getAgentInvite()==true?1:0, info.getVip(), "验证数据库mch_info中的Vip(如果代理可以邀请代理商，vip=1)");
		country_info country_info=country_infoWapper.selectByPrimaryKey(bean.getCountry());
		Logger.verifyEquals(country_info.getCurrency(), info.getCurrency(), "验证数据库mch_info中的Currency");
		Logger.verifyEquals(bean.getCountry(), info.getCountry(), "验证数据库mch_info中的Country");

		Logger.verifyEquals(0, info.getState(), "验证数据库mch_info中的State");
		
		Logger.verifyEquals(bean.getMchShareType(), info.getMchShareType(), "验证数据库mch_info中的MchShareType");
		
		Logger.verifyEquals(2, info.getMchType(), "验证数据库mch_info中的MchType");
		//独立商户 新增 20200326
		Logger.verifyEquals(1, info.getIndepMchFlg(), "验证数据库mch_info中的IndepMchFlg独立商户标识(1:独立商户主商户 2:独立商户供货商 3:独立商户代理商)");
		//mch_config
		Logger.verifyEquals(bean.getLogo(), config.getLogo(), "验证数据库mch_config中的Logo");
		Logger.verifyEquals(bean.getTitle(), config.getTitle(), "验证数据库mch_config中的Title");
		Logger.verifyEquals(bean.getHomeBanner(), config.getHomeBanner(), "验证数据库mch_config中的HomeBanner");
		if(bean.getPcDomain()==null)
			Logger.verifyEquals(bean.getDomain(), config.getPcDomain(), "验证数据库mch_config中的PcDomain");
		else
		   Logger.verifyEquals(bean.getPcDomain(), config.getPcDomain(), "验证数据库mch_config中的PcDomain");
		
		if(bean.getH5Domain()==null)
			Logger.verifyEquals(bean.getDomain(), config.getH5Domain(), "验证数据库mch_config中的H5Domain");
		else
		  Logger.verifyEquals(bean.getH5Domain(), config.getH5Domain(), "验证数据库mch_config中的H5Domain");
		
		if(bean.getAppDomain()==null)
			Logger.verifyEquals(bean.getDomain(), config.getAppDomain(), "验证数据库mch_config中的AppDomain");
		else
		   Logger.verifyEquals(bean.getAppDomain(), config.getAppDomain(), "验证数据库mch_config中的AppDomain");
		
		if(bean.getS1Domian()==null)
			Logger.verifyEquals(bean.getDomain(), config.getS1Domain(), "验证数据库mch_config中的S1Domian");
		else
		   Logger.verifyEquals(bean.getS1Domian(), config.getS1Domain(), "验证数据库mch_config中的S1Domian");
		
		Logger.verifyEquals(bean.getWxAppId(), config.getWxAppId(), "验证数据库mch_config中的WxAppId");
		Logger.verifyEquals(bean.getWxSecret(), config.getWxSecret(), "验证数据库mch_config中的WxSecret");
		Logger.verifyEquals(bean.getWxAppIdBuyer(), config.getWxAppIdBuyer(), "验证数据库mch_config中的WxAppIdBuyer");
		Logger.verifyEquals(bean.getWxSecretBuyer(), config.getWxSecretBuyer(), "验证数据库mch_config中的WxSecretBuyer");
		Logger.verifyEquals(bean.getWxAppIdPc(), config.getWxAppIdPc(), "验证数据库mch_config中的WxAppIdPc");
		Logger.verifyEquals(bean.getWxSecretPc(), config.getWxSecretPc(), "验证数据库mch_config中的WxSecretPc");
		Logger.verifyEquals(bean.getWxAppIdApp(), config.getWxAppIdApp(), "验证数据库mch_config中的WxAppIdApp");
		Logger.verifyEquals(bean.getWxSecretApp(), config.getWxSecretApp(), "验证数据库mch_config中的WxSecretApp");
		Logger.verifyEquals(bean.getWxAppIdH5(), config.getWxAppIdH5(), "验证数据库mch_config中的WxAppIdH5");
		Logger.verifyEquals(bean.getWxSecretH5(), config.getWxSecretH5(), "验证数据库mch_config中的WxSecretH5");
		
		Logger.verifyEquals(bean.getAgentPublish(), config.getAgentPuhlish(), "验证数据库mch_config中的AgentPuhlish 代理商能否发布商品");
		Logger.verifyEquals(bean.getAgentInvite(), config.getAgentInvite(), "验证数据库mch_config中的AgentInvite代理商能否邀请代理");
		Logger.verifyEquals(bean.getAgentInheritShareType(), config.getAgentInheritShareType(), "验证数据库mch_config中的AgentInheritShareType代理商是否继承渠道商店铺买家端呈现形式");
		//独立商户不约束风控，商品风控和交易风控字段都为0
		Logger.verifyEquals("0",config.getProductRiskAmount().stripTrailingZeros().toPlainString(), "验证数据库mch_config 中字段ProductRiskAmount=0,不受限制");
        Logger.verifyEquals("0",config.getTradeRiskAmount().stripTrailingZeros().toPlainString(), "验证数据库mch_config 中字段getTradeRiskAmount=0,不受限制");
        //备案号 20200302
        Logger.verifyEquals(bean.getIcpName(),config.getIcpName(), "验证数据库mch_config 中字段IcpName");
        Logger.verifyEquals(bean.getIcpCode(),config.getIcpCode(), "验证数据库mch_config 中字段IcpCode");

		//修改 20200409 独立小程序默认是自由支付
		Logger.verifyEquals(5, info.getPayMode(), "验证数据库mch_info中的paymode=5 自有支付");
        //默认开通domesticPayMode=1 盛付通-海鲲科技
        Logger.verifyEquals(1, info.getDomesticPayMode(), "验证数据库mch_info中的DomesticPayMode");
        //商户所在的国家如果不支持本国币种结算，落地USD，否则落地对应国家币种
        country_info countryinfo=countryinfoWapper.selectByPrimaryKey(info.getCountry());
        if(countryinfo.getSupportLocalCurrency().equals(0))
        	Logger.verifyEquals("USD", info.getCurrency(), "验证数据库mch_info中的Currency");
        else
        	Logger.verifyEquals(countryinfo.getCurrency(), info.getCurrency(), "验证数据库mch_info中的Currency");
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_001() {
		Logger.start(true,"正例-创建独立商户-默认");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMchShareType(3);
			bean.setAgentPublish(false);
			bean.setAgentInheritShareType(false);
			bean.setAgentInvite(false);
			
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_002() {
		Logger.start(true,"正例-创建独立商户-代理商能发布商品");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAgentPublish(true);
			call.setData(bean);
			call.callService();	
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_004() {
		Logger.start(true,"正例-创建独立商户-代理商能邀请代理");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAgentInvite(true);
			call.setData(bean);
			call.callService();	
			
			check_verify();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_006() {
		Logger.start(true,"正例-创建独立商户-代理商可以继承渠道商店铺买家端呈现形式");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAgentInheritShareType(true);
			call.setData(bean);
			call.callService();	
			
			check_verify();				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_008() {
		Logger.start(true,"正例-创建独立商户-国家码不存在");
		try {
			
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setCountry("1111");
			call.setData(bean);
			call.callService();	
			
			Logger.verifyEquals("5015", call.getStatusCode1(), "验证status");
			Logger.verifyEquals("国家信息有误", call.getMessage(), "验证Message");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_009() {
		Logger.start(true,"正例-创建独立商户-国家码为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setCountry(null);
			call.setData(bean);
			call.callService();	
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_createIndepMch_010() {
		Logger.start(true,"正例-创建独立商户-手机区号不存在,区号目前没有做校验,忽略");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAreaCode("12313");
			call.setData(bean);
			call.callService();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_011() {
		Logger.start(true,"正例-创建独立商户-手机区号为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAreaCode(null);
			call.setData(bean);
			call.callService();		
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_012() {
		Logger.start(true,"正例-创建独立商户-店铺买家端呈现形式H5");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAgentInheritShareType(false);//如不继承默认设置成H5
			call.setData(bean);
			call.callService();				
			
			check_verify();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_013() {
		Logger.start(true,"正例-创建独立商户-手机号为空");
		try {
			
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMobile(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_014() {
		Logger.start(true,"正例-创建独立商户-密码为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setPassword(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_014_1() {
		Logger.start(true,"正例-创建独立商户-密码格式错误,6-9位数字和英文字母组合");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setPassword("11");
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_015() {
		Logger.start(true,"正例-创建独立商户-商户logo为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setLogo(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_016() {
		Logger.start(true,"正例-创建独立商户-商户标题为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setTitle(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_017() {
		Logger.start(true,"正例-创建独立商户-首页图片为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setHomeBanner(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_018() {
		Logger.start(true,"正例-创建独立商户-wxAppIdPc为空");
		try {
			
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxAppIdPc(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_019() {
		Logger.start(true,"正例-创建独立商户-wxSecretPc为空");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxSecretPc(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_020() {
		Logger.start(true,"正例-创建独立商户-wxAppIdApp为空");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxAppIdApp(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_021() {
		Logger.start(true,"正例-创建独立商户-wxSecretApp为空");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxSecretApp(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_022() {
		Logger.start(true,"正例-创建独立商户-wxAppIdH5为空");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxAppIdH5(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_023() {
		Logger.start(true,"正例-创建独立商户-wxSecretH5为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setWxSecretH5(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_024() {
		Logger.start(true,"正例-创建独立商户-appSource为空");
		try {
			
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setAppSource(null);
			call.setData(bean);
			call.callService();				
			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_createIndepMch_025() {
		Logger.start(true,"正例-创建独立商户-appSource不存在,目前有60,61,62,63,64");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMobile("186"+TestDataManager.getRandomIntNum(8));
			bean.setAppSource(666);
			call.setData(bean);
			call.callService();				
			org.junit.Assert.fail();
			///Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void c_createIndepMch_026() {
		Logger.start(true,"正例-创建独立商户-terminalSource为空");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setTerminalSource(null);
			bean.setAppSource(666);
			call.setData(bean);
			call.callService();				
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_createIndepMch_027() {
		Logger.start(true,"正例-创建独立商户-terminalSource不存在,目前有0,1,2,3,4");
		try {

			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setTerminalSource(5555);
			call.setData(bean);
			call.callService();		
			
			org.junit.Assert.fail();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_028() {
		Logger.start(true,"正例-创建独立商户-申请被拒绝-再重新申请");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			call.setData(bean);
			call.callService();			
			//申请代理
			applyAgentBean applyBean=GodmchManageCallService.InitApplyAgentBean();
			applyBean.setMchId(call.getmchId());
			applyAgentCall applyCall=GodmchManageCallService.ApplyAgentCall(applyBean);
			//拒绝
			rejectAgentBean rejectBean=GodmchManageCallService.initRejectAgentBean();
			rejectBean.setMchId(call.getmchId());
			rejectBean.setAgentId(applyCall.getAgentId());
			GodmchManageCallService.rejectAgentCall(rejectBean);
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_029() {
		Logger.start(true,"正例-创建独立商户-店铺买家端呈现形式是1:小程序");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMchShareType(1);//店铺买家端呈现形式1:小程序 2:h5
			
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_030() {
		Logger.start(true,"正例-创建独立商户-店铺买家端呈现形式是2:h5");
		try {
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMchShareType(2);//店铺买家端呈现形式1:小程序 2:h5
			
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_createIndepMch_031() {
		//20200509 独立商户店铺类型只能是1或者2
		Logger.start(true,"正例-创建独立商户店铺买家端呈现形式是3:独立小程序-申请通过-代理的呈现形式也是5:继承版小程序");
		////分享方式1：小程序 2：H5 3：独立小程序  4：独立h5  5：继承版小程序
		try {

			//通过
			approveAgentBean approveAgentBean=GodmchManageCallService.InitApproveAgentBean();
			//approveAgentBean.setMchId(call.getmchId());
			//approveAgentBean.setAgentId(applyCall.getAgentId());
			GodmchManageCallService.ApproveAgentCall(approveAgentBean);
			//验证
			List<Integer> channl_mchIds=new ArrayList<Integer>();
			channl_mchIds.add(approveAgentBean.getMchId());
			mch_info  channl_info=infoWapper.selectbyMchIds(channl_mchIds).get(0);
			
			List<Integer> agent_mchIds=new ArrayList<Integer>();
			agent_mchIds.add(approveAgentBean.getAgentId());
			mch_info  agent_info=infoWapper.selectbyMchIds(agent_mchIds).get(0);
			Logger.verifyEquals(3,channl_info.getMchShareType(), "验证独立商户是独立小程序");
			Logger.verifyEquals(5,agent_info.getMchShareType(), "验证独立商户是独立小程序时,代理是小程序继承版");
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_createIndepMch_032() {
		Logger.start(true,"正例-创建独立商户店铺买家端呈现形式是4:独立h5-申请通过-代理的呈现形式也是4:独立h5");
		//分享方式1：小程序 2：H5 3：独立小程序  4：独立h5  5：继承版小程序
		try {

			//1：创建独立商户
			bean=GodmchManageCallService.InitCreateIndepMchBean();
			bean.setMchShareType(4);
			call.setData(bean);
			call.callService();
			
			//2：申请代理
			applyAgentBean applyBean=GodmchManageCallService.InitApplyAgentBean();
			applyBean.setMchId(call.getmchId());
			applyBean.setAppKey("appsqSeller_"+call.getmchId());
			applyAgentCall applyCall=GodmchManageCallService.ApplyAgentCall(applyBean);
			//代理类型
			createagentBean agentBean=GodmchManageCallService.InitCreateAgentTypeBean(applyBean.getMchId());
			createagentCall agentCall=GodmchManageCallService.CreateAgentTypeCall(agentBean);
			//查询代理类型
			Map<String,Object> map=new HashMap();
			map.put("mchId", applyBean.getMchId());
			List<agent_type> list=GodmchManageCallService.agentTypeWapper.selectby(map);
			//3:审核代理
			approveAgentBean approveAgentBean=new approveAgentBean();
			approveAgentBean.setMchId(applyBean.getMchId());
			approveAgentBean.setAgentId(applyCall.getAgentId());
			approveAgentBean.setAgentType(list.get(0).getAgentType());
			approveAgentBean.setAgentMode(1);
		
			GodmchManageCallService.ApproveAgentCall(approveAgentBean);

			//验证
			List<Integer> channl_mchIds=new ArrayList<Integer>();
			channl_mchIds.add(call.getmchId());
			mch_info  channl_info=infoWapper.selectbyMchIds(channl_mchIds).get(0);
			
			List<Integer> agent_mchIds=new ArrayList<Integer>();
			agent_mchIds.add(call.getmchId());
			mch_info  agent_info=infoWapper.selectbyMchIds(agent_mchIds).get(0);
			Logger.verifyEquals(bean.getMchShareType(),channl_info.getMchShareType(), "验证独立商户是独立H5");
			Logger.verifyEquals(4,channl_info.getMchShareType(), "验证独立商户是独立H5");
			Logger.verifyEquals(4,agent_info.getMchShareType(), "验证独立商户是H5时 代理是H5");
			
		} catch (Exception e) {
			Logger.fail(e); 
		}
	}
	
}